<?php

namespace common\models\kaoguobao;

use Yii;
use common\models\BaseModels;
use yii\behaviors\TimestampBehavior;

class Hour extends BaseModels
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%hour}}';
    }

    /**
     * 切换数据库(测试环境)
     */
    public static function getDb(){
        return Yii::$app->get('db_kgb');
    }

    /**
     * 给数据库的处理进行时间的操作
     */
    public function behaviors() {
        return [
            TimestampBehavior::className(),
        ];
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [[  'id',
                'hour',
                'hour_click_request',
                'key',
                'type',
            ], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id'                  => Yii::t('app_table', 'ID'),
            'hour'                => Yii::t('app_table', '小时段'),
            'hour_click_request'  => Yii::t('app_table', '时点击量'),
            'key'                 => Yii::t('app_table', '键值，区分产品'),
            'type'                => Yii::t('app_table', '类型'),
        ];
    }
}